﻿using GrpcHelloWorldServer.Protos;
using Grpc.Core;


namespace GrpcHelloWorldServer.Services;

public class HelloWorldServices : HelloWorldService.HelloWorldServiceBase
{

    private readonly ILogger<HelloWorldServices> _logger;

    public HelloWorldServices(ILogger<HelloWorldServices> logger)
    {
        _logger = logger ?? throw new ArgumentNullException(nameof(logger));
    }


    public override Task<HelloWorldResponst> SayHello(HelloWorldRequest request, ServerCallContext context)
    {
        string result = $"Hello, {request.Name}!";
        var response = new HelloWorldResponst
        {
            Message = result
        };

        return Task.FromResult(response);
    }
}
